<form class="form-horizontal" role="form" method="get" action="<?=site_url('exportw/history') ?>">  
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Tìm theo ngày</label>
    <div class="container">
	    <div class="col-sm-6" style="height:75px;">
         <div class='col-md-5' style="margin-right:10px;">
              <div class="form-group">
                  <div class='input-group date' id='datetimepicker8'>
                      <input type='text' name="fromDate" class="form-control" placeholder="Chọn từ ngày" value="<?=isset($fromDate) ? $fromDate : "" ?>" />
                      <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                      </span>
                  </div>
              </div>
          </div>              
          <div class='col-md-5' style="">
              <div class="form-group">
                  <div class='input-group date' id='datetimepicker9'>
                      <input type='text' name="toDate" class="form-control" placeholder="tới ngày" value="<?=isset($toDate) ? $toDate : "" ?>"/>
                      <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                      </span>
                  </div>
              </div>
          </div>
      </div>    
      <script type="text/javascript">
          $(function () {
              $('#datetimepicker8').datetimepicker();
              $('#datetimepicker9').datetimepicker();
              $("#datetimepicker8").on("dp.change",function (e) {
                 $('#datetimepicker9').data("DateTimePicker").setMinDate(e.date);
              });
              $("#datetimepicker9").on("dp.change",function (e) {
                 $('#datetimepicker8').data("DateTimePicker").setMaxDate(e.date);
              });
          });
      </script>
      <button type="submit" class="btn btn-primary">Tìm kiếm</button></td>
  </div>   
</form>

<?php echo isset($warning) ? '<div class="alert bg-danger">'.$warning.'</div>' : "" ?>

<form method="get" action="<?=site_url('exportw/printExcel') ?>">
	<input type="hidden" name="fromDate" value="<?=isset($fromDate) ? $fromDate : "" ?>"/>
	<input type="hidden" name="toDate" value="<?=isset($toDate) ? $toDate : "" ?>">
	<p><button type="submit" name="printExcelBtn" value="xuat-file-excel" class="btn btn-primary">Xuất file Excel</button></p>
</form>

<div class="table-responsive">
	<table class="table table-bordered">
		<thead>
			<tr align="center" class="success">
				<td>Người xuất</td>
				<td>Lý do</td>
				<td>Sản phẩm</td>
				<td>Size</td>
				<td>Code</td>
				<td>Kho</td>				
				<td>Ngày nhập</td>
			</tr>
		</thead>
		<tbody>
			<?php	
				$i = 1;			
				foreach ($history as $row):					
					
					echo "<tr align='center'>
						  <td>".$row->people."</td>
						  <td>".$row->reason."</td> 	
						  <td>".$row->product."</td>
						  <td>".$row->size."</td>
						  <td>".$row->code."</td>
						  <td>".$row->storage."</td>
						  <td>".$row->date_created."</td>						  
						  </tr>
						  ";

					$i++;
				endforeach;
			?>
		</tbody>
	</table>
	<?=!empty($paging_history) ? "<div class='pull-right'><span>Tổng cộng: $total sản phẩm</span><br>$paging_history</div>" : "" ?>
</div>